package com.probiz.estore.common.model.content.base;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.content.NewsletterGroup;
import com.probiz.estore.core.model.BaseObject;

/**
 * Newsletter Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 * Message that composed by admin and will be sent to customer
 */
public class NewsletterTbl extends BaseObject implements Serializable {

    protected Integer newsletterId;
	protected String title;
	protected String content;
	protected String templatePath;
	protected java.util.Date sendTime;
	protected Short toAllCustomers;
	protected Short status;
	protected Integer createBy;
	protected Integer updateBy;
	protected java.util.Date createTime;
	protected java.util.Date updateTime;
	protected Integer version;
	protected java.util.Set<NewsletterGroup> newsletterGroups = new java.util.HashSet<NewsletterGroup>();


	/**
	 * Default Empty Constructor for class Newsletter
	 */
	public NewsletterTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class Newsletter
	 */
	public NewsletterTbl (
		 Integer in_newsletterId
        ) {
		this.setNewsletterId(in_newsletterId);
    }

	
	public java.util.Set<NewsletterGroup> getNewsletterGroups() {
		return newsletterGroups;
	}

	public void setNewsletterGroups(java.util.Set<NewsletterGroup> newsletterGroups) {
		this.newsletterGroups = newsletterGroups;
	}

	/**
	 * 	 * @return Integer
     * @hibernate.id column="newsletterId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getNewsletterId() {
		return this.newsletterId;
	}
	
	/**
	 * Set the newsletterId
	 */	
	public void setNewsletterId(Integer aValue) {
		this.newsletterId = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="title" type="java.lang.String" length="256" not-null="true" unique="false"
	 */
	public String getTitle() {
		return this.title;
	}
	
	/**
	 * Set the title
	 * @spring.validator type="required"
	 */	
	public void setTitle(String aValue) {
		this.title = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="content" type="java.lang.String" length="65535" not-null="true" unique="false"
	 */
	public String getContent() {
		return this.content;
	}
	
	/**
	 * Set the content
	 * @spring.validator type="required"
	 */	
	public void setContent(String aValue) {
		this.content = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="templatePath" type="java.lang.String" length="128" not-null="false" unique="false"
	 */
	public String getTemplatePath() {
		return this.templatePath;
	}
	
	/**
	 * Set the templatePath
	 */	
	public void setTemplatePath(String aValue) {
		this.templatePath = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="sendTime" type="java.util.Date" length="0" not-null="false" unique="false"
	 */
	public java.util.Date getSendTime() {
		return this.sendTime;
	}
	
	/**
	 * Set the sendTime
	 */	
	public void setSendTime(java.util.Date aValue) {
		this.sendTime = aValue;
	}
	
	/**
	 * 0 = false
            1 = true  send this newsletter to all the customers in APP_USER table	 * @return Short
	 * @hibernate.property column="toAllCustomers" type="java.lang.Short" length="5" not-null="false" unique="false"
	 */
	public Short getToAllCustomers() {
		return this.toAllCustomers;
	}
	
	/**
	 * Set the toAllCustomers
	 */	
	public void setToAllCustomers(Short aValue) {
		this.toAllCustomers = aValue;
	}
	
	/**
	 * 0 = not sent
            1 = sent	 * @return Short
	 * @hibernate.property column="status" type="java.lang.Short" length="5" not-null="true" unique="false"
	 */
	public Short getStatus() {
		return this.status;
	}
	
	/**
	 * Set the status
	 */	
	public void setStatus(Short aValue) {
		this.status = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="createBy" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getCreateBy() {
		return this.createBy;
	}
	
	/**
	 * Set the createBy
	 */	
	public void setCreateBy(Integer aValue) {
		this.createBy = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="updateBy" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getUpdateBy() {
		return this.updateBy;
	}
	
	/**
	 * Set the updateBy
	 */	
	public void setUpdateBy(Integer aValue) {
		this.updateBy = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="createTime" type="java.util.Date" length="0" not-null="false" unique="false"
	 */
	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	
	/**
	 * Set the createTime
	 */	
	public void setCreateTime(java.util.Date aValue) {
		this.createTime = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="updateTime" type="java.util.Date" length="0" not-null="false" unique="false"
	 */
	public java.util.Date getUpdateTime() {
		return this.updateTime;
	}
	
	/**
	 * Set the updateTime
	 */	
	public void setUpdateTime(java.util.Date aValue) {
		this.updateTime = aValue;
	}	

	
	/**
	 * 	 * @return Integer
	 * @hibernate.property column="version" type="java.lang.Integer" length="10" not-null="true" unique="false"
	 */
	public Integer getVersion() {
		return this.version;
	}
	
	/**
	 * Set the version
	 * @spring.validator type="required"
	 */	
	public void setVersion(Integer aValue) {
		this.version = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof NewsletterTbl)) {
			return false;
		}
		NewsletterTbl rhs = (NewsletterTbl) object;
		return new EqualsBuilder()
				.append(this.newsletterId, rhs.newsletterId)
				.append(this.title, rhs.title)
				.append(this.content, rhs.content)
				.append(this.templatePath, rhs.templatePath)
				.append(this.sendTime, rhs.sendTime)
				.append(this.toAllCustomers, rhs.toAllCustomers)
				.append(this.status, rhs.status)
				.append(this.createBy, rhs.createBy)
				.append(this.updateBy, rhs.updateBy)
				.append(this.createTime, rhs.createTime)
				.append(this.updateTime, rhs.updateTime)
						.append(this.version, rhs.version)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.newsletterId) 
				.append(this.title) 
				.append(this.content) 
				.append(this.templatePath) 
				.append(this.sendTime) 
				.append(this.toAllCustomers)
				.append(this.status) 
				.append(this.createBy) 
				.append(this.updateBy) 
				.append(this.createTime) 
				.append(this.updateTime) 
						.append(this.version) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("newletterId", this.newsletterId) 
				.append("title", this.title) 
				.append("content", this.content) 
				.append("templatePath", this.templatePath) 
				.append("sendTime", this.sendTime) 
				.append("toAllCustomers", this.toAllCustomers)
				.append("status", this.status) 
				.append("createBy", this.createBy) 
				.append("updateBy", this.updateBy) 
				.append("createTime", this.createTime) 
				.append("updateTime", this.updateTime) 
						.append("version", this.version) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "newletterId";
	}
	
	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return newsletterId;
	}

}